﻿using System;
using System.Windows.Data;

namespace Matchingo.Common.Types.Converters
{
    public class TimerDisplayConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            TimeSpan ts = (TimeSpan)value;

            if (ts.TotalSeconds > 999.99D)
                return "999.99";

            return ts.TotalSeconds.ToString("N2");
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}